﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MB.Orm.DB;
using MB.RuleBase.Common;
using Model;
using Public.DataAccess;

namespace Business.Service
{
    public class BDCUserManage
    {
        public BDCUserManage() { }
        /// <summary>
        /// 获取用户关联信息
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="total"></param>
        /// <param name="parValues"></param>
        /// <returns></returns>
        public List<DCUserManage> GetDCUserManageInfo(int pageIndex, int pageSize, out int total, params object[] parValues)
        {
            using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("NewWeb")))
            {
                List<DCUserManage> lstDCUserManage = PagedDatabaseExcuteByXmlHelper.NewInstance.GetPagedObjectsByXml3<DCUserManage>
                                                ("DCDBA", "GetDCUserManageInfo", pageIndex, pageSize, out total, parValues);
                return lstDCUserManage;
            }
        }
        /// <summary>
        /// 查询帐号是否存在
        /// </summary>
        /// <param name="ThirdName"></param>
        /// <returns></returns>
        public List<DCUserManage> GetDCUserManageByCode(string userCode)
        {
            using (var DbScope = new OperationDatabaseScope(new OperationDatabaseContext("NewWeb")))
            {
                List<DCUserManage> lstDCThirdInfo = DatabaseExcuteByXmlHelper.NewInstance.GetObjectsByXml<DCUserManage>("DCDBA", "GetDCUserManageByCode", userCode);
                return lstDCThirdInfo;
            }
        }
        /// <summary>
        /// 新增用户关联信息
        /// </summary>
        /// <param name="dCwarehouse"></param>
        /// <returns></returns>
        public int AddDCUserManage(DCUserManage dCUserManage)
        {
            return DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQueryByEntity<DCUserManage>("DCDBA", "AddDCUserManage", dCUserManage);
        }
        /// <summary>
        /// 更新前用户关联信息
        /// </summary>
        /// <param name="dCwarehouse"></param>
        /// <returns></returns>
        public int UpdateDCUserManage(DCUserManage dCUserManage)
        {
            return DatabaseExcuteByXmlHelper.NewInstance.ExecuteNonQueryByEntity<DCUserManage>("DCDBA", "UpdateDCUserManage", dCUserManage);
        }
    }
}
